#include "AxisManager.h"

AxisManager::AxisManager() {}

AxisManager::~AxisManager() {}

void AxisManager::TimeTick() {
    for (int i = 0; i < drivers.size(); i++) {
        drivers[i]->TimeTick();
    }
}

void AxisManager::PowerOn(int axis_index) {
    if (axis_index < drivers.size()) {
        drivers[axis_index]->PowerOn();
    }
}

void AxisManager::PowerOff(int axis_index) {
    if (axis_index < drivers.size()) {
        drivers[axis_index]->PowerOff();
    }
}

void AxisManager::Home(int axis_index) {
    if (axis_index < drivers.size()) {
        drivers[axis_index]->Home();
    }
}

void AxisManager::CancelHome(int axis_index) {
    if (axis_index < drivers.size()) {
        drivers[axis_index]->CancelHome();
    }
}

void AxisManager::AddDriver(SlavePDOS* pdos) {
    drivers.push_back(std::make_shared<Driver::DriverModel>(pdos));
}
